package com.collections.www;



import java.util.Comparator;

public class StudentComparator implements Comparator<Student> {
    @Override
    public int compare(Student o1, Student o2) {
        // 默认返回值
        int iVal = 0;
        if (o1 != null && o2 != null) {
            // 比较o1和o2的大小
            if (o1.getId() > o2.getId()) {
                iVal = 1;
            } else if (o1.getId() < o2.getId()) {
                iVal = -1;
            }
        }
        return iVal*-1;
    }
}
